#include<iostream>
using namespace std;

class Television
{
private:
    static int DVD_num,TV_num;
    int voice,channel,mode,num;
public:
    Television()
    {
        TV_num++;
        voice=50;
        mode=1;
        num=TV_num;
        channel=0;
    }
    static int getDVD_num()
    {
        return DVD_num;
    }
    static int getTV_num()
    {
        return TV_num;
    }
    friend void remote_control(Television &p,int mode,int channel,int voice);
};

int Television::DVD_num=0;
int Television::TV_num=0;

void remote_control(Television &p,int mode,int channel,int voice)
{
    if(p.mode==1)
    {
        Television::TV_num--;
    }else
    {
        Television::DVD_num--;
    }
    p.mode=mode;
    p.channel=channel;
    p.voice+=voice;
    if(p.voice<0)
    {
        p.voice=0;
    }
    if(p.voice>100)
    {
        p.voice=100;
    }
    cout<<"第"<<p.num<<"号电视机--";
    if(p.mode==1)
    {
        cout<<"TV模式--频道";
        Television::TV_num++;
    }else
    {
        cout<<"DVD模式--频道";
        Television::DVD_num++;
    }
    cout<<p.channel<<"--音量"<<p.voice<<endl;
}


int main()
{
    int n;
    cin>>n;
    Television *p=new Television[n];
    int t;
    cin>>t;
    while(t--)
    {
        int num,voice,mode,channel;
        cin>>num>>mode>>channel>>voice;
        remote_control(p[num-1],mode,channel,voice);
    }
    cout<<"播放电视的电视机数量为"<<p[0].getTV_num()<<endl;
    cout<<"播放DVD的电视机数量为"<<p[0].getDVD_num()<<endl;
    return 0;
}